package com.wangsh.usersCenter.system.pojo;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.JSONArray;
import com.wangsh.usersCenter.common.pojo.BasePojo;
import com.wangsh.usersCenter.users.pojo.AAdmins;

/**
 * 全局分类的pojo
 */
public class ACate extends BasePojo<ACate>
{
	//主键id
	private int id;
	//管理员创建id
	private int createId;
	//管理员更新id
	private int updateId;
	private int parentId;
	private String name;
	private String url;
	private String templCon;
	private byte cateType;
	private String content;
	private byte leafStatus;
	private byte status ; 
	private Date createTime;
	private Date updateTime;
	private Date pubTime ;
	private AAdmins createAdmins;
	private AAdmins updateAdmins;
	
	// 对象的表示,关联关系
	private ACate parentCate;
	
	//树形分类的字符串表示  treeName是爷爷  爸爸  自己的字符串表达形态
	private String treeName ; 
	private String statusStr ;
	private String leafStatusStr;
	private String cateTypeStr;
	
	//json的表现方式                 treeRegion是爷爷 爸爸  自己     childrenList是儿子
	private List<ACate> treeCate; 
	
	private List<ACate> childrenList ; 
	
	
	/* 存储所有状态的容器 */
	private Map<String,String> enumsMap = new TreeMap<String, String>();

	public Map<String, String> getEnumsMap()
	{
		// 根据状态值获取字符串描述
		ACateEnum[] acateEnums = ACateEnum.values();
		for (int i = 0; i < acateEnums.length; i++)
		{
			ACateEnum acateEnum = acateEnums[i];
			String key = acateEnum.toString() ; 
			enumsMap.put(key + "-" + acateEnum.getStatus() + "", acateEnum.getName());
		}
		return enumsMap;
	}
	
	
	public String getStatusStr()
	{
		// 根据状态值获取字符串描述
		ACateEnum[] cateEnums = ACateEnum.values();
		for (int i = 0; i < cateEnums.length; i++)
		{
			ACateEnum cateEnum = cateEnums[i];
			if (cateEnum.toString().startsWith("STATUS_"))
			{
				// 表示是状态的标识
				if (cateEnum.getStatus() == this.getStatus())
				{
					this.statusStr = cateEnum.getName();
					break;
				}
			}
		}
		return statusStr;
	}
	public String getCateTypeStr()
	{
		// 根据状态值获取字符串描述
		ACateEnum[] cateEnums = ACateEnum.values();
		for (int i = 0; i < cateEnums.length; i++)
		{
			ACateEnum cateEnum = cateEnums[i];
			if (cateEnum.toString().startsWith("CLASSIFICATION_"))
			{
				// 表示是状态的标识
				if (cateEnum.getStatus() == this.getCateType())
				{
					this.cateTypeStr = cateEnum.getName();
					break;
				}
			}
		}
		return cateTypeStr;
	}
	
	public String getLeafStatusStr()
	{
		// 根据状态值获取字符串描述
		ACateEnum[] cateEnums = ACateEnum.values();
		for (int i = 0; i < cateEnums.length; i++)
		{
			ACateEnum cateEnum = cateEnums[i];
			if (cateEnum.toString().startsWith("LEAFSTATUS_"))
			{
				// 表示是状态的标识
				if (cateEnum.getStatus() == this.getLeafStatus())
				{
					this.leafStatusStr = cateEnum.getName();
					break;
				}
			}
		}
		return leafStatusStr;
	}
	
	public int getId()
	{
		return id;
	}
	public void setId(int id)
	{
		this.id = id;
	}
	public int getCreateId()
	{
		return createId;
	}
	public void setCreateId(int createId)
	{
		this.createId = createId;
	}
	public int getUpdateId()
	{
		return updateId;
	}
	public void setUpdateId(int i)
	{
		this.updateId = i;
	}
	public int getParentId()
	{
		return parentId;
	}
	public void setParentId(int parentId)
	{
		this.parentId = parentId;
	}
	public String getName()
	{
		return name;
	}
	public void setName(String name)
	{
		this.name = name;
	}
	public String getUrl()
	{
		return url;
	}
	public void setUrl(String url)
	{
		this.url = url;
	}
	public String getTemplCon()
	{
		return templCon;
	}
	public void setTemplCon(String templCon)
	{
		this.templCon = templCon;
	}
	public byte getCateType()
	{
		return cateType;
	}
	public void setCateType(byte cateType)
	{
		this.cateType = cateType;
	}
	public String getContent()
	{
		return content;
	}
	public void setContent(String content)
	{
		this.content = content;
	}
	public byte getLeafStatus()
	{
		return leafStatus;
	}
	public void setLeafStatus(byte leafStatus)
	{
		this.leafStatus = leafStatus;
	}
	public byte getStatus()
	{
		return status;
	}
	public void setStatus(byte status)
	{
		this.status = status;
	}
	public Date getCreateTime()
	{
		return createTime;
	}
	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}
	public Date getUpdateTime()
	{
		return updateTime;
	}
	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}
	public Date getPubTime()
	{
		return pubTime;
	}
	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}
	public List<ACate> getChildrenList()
	{
		return childrenList;
	}

	public void setChildrenList(List<ACate> childrenList)
	{
		this.childrenList = childrenList;
	}
	@Override
	public String toString()
	{
		return "ACate [id=" + id + ", createId=" + createId + ", updateId=" + updateId + ", parentId=" + parentId
				+ ", name=" + name + ", url=" + url + ", templCon=" + templCon + ", cateType=" + cateType + ", content="
				+ content + ", leafStatus=" + leafStatus + ", status=" + status + ", createTime=" + createTime
				+ ", updateTime=" + updateTime + ", pubTime=" + pubTime + ", statusStr=" + statusStr
				+ ", leafStatusStr=" + leafStatusStr + ", childrenList=" + childrenList + ", enumsMap=" + enumsMap
				+ "]";
	}

	public String getTreeName()
	{
		return treeName;
	}

	public void setTreeName(String treeName)
	{
		this.treeName = treeName;
	}

	public ACate getParentCate()
	{
		return parentCate;
	}

	public void setParentCate(ACate parentCate)
	{
		this.parentCate = parentCate;
	}


	public List<ACate> getTreeCate()
	{
		return treeCate;
	}


	public void setTreeCate(List<ACate> treeCate)
	{
		this.treeCate = treeCate;
	}


	public AAdmins getCreateAdmins()
	{
		return createAdmins;
	}


	public void setCreateAdmins(AAdmins createAdmins)
	{
		this.createAdmins = createAdmins;
	}


	public AAdmins getUpdateAdmins()
	{
		return updateAdmins;
	}


	public void setUpdateAdmins(AAdmins updateAdmins)
	{
		this.updateAdmins = updateAdmins;
	}
}
